package org.lanqiao.tjut.chengxu06;

import java.util.Scanner;

import org.junit.Test;

public class Zuidagongyue {

	@Test
	public void test1() {
		int i, j, k, a;
		System.out.println("输入两个正整数：");
		Scanner input0 = new Scanner(System.in);
		Scanner input1 = new Scanner(System.in);
		i = input0.nextInt();
		j = input1.nextInt();
		//调用递归
		a = (int) digui(i, j);

		k = i * j / a;
		System.out.println("最大公约数为：" + a);

		System.out.println("最小公倍数为：" + k);

	}

	public Object digui(int i, int j) {
		int a;
		//总让i>j
		if (i < j) {
			a = j;
			j = i;
			i = a;
		}
		a = i % j;
		//递归函数，余数为0返回，小的数
		if (a == 0) {
			return j;
			
		} else {
//余数不为0返回除数和余数
			return digui(a, j);

		}

	}
}
